package com.ruicar.afs.cloud.basic.common.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruicar.afs.cloud.basic.common.entity.BasicChannelInfo;
import com.ruicar.afs.cloud.basic.common.entity.BasicCustContacts;
import com.ruicar.afs.cloud.basic.common.service.BasicChannelInfoService;
import com.ruicar.afs.cloud.basic.common.service.BasicCustContactsService;
import com.ruicar.afs.cloud.common.core.util.IResponse;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: Lee
 * @date: 2020/5/11 19:39
 * @description: 联系人信息增删改查
 */
@Slf4j
@RestController
@RequestMapping("/custContactsInfo")
@AllArgsConstructor
public class BasicCustContactsController {
    private final BasicCustContactsService basicCustContactsService;

    @ApiOperation(value = "根据合同号码查询联系人信息")
    @PostMapping("/getCustContactsInfoList")
    public IResponse<List<BasicCustContacts>> getCustContactsInfoList(@RequestParam("contractNo") String contractNo){
        List<BasicCustContacts> basicCustContacts = basicCustContactsService.list(Wrappers.<BasicCustContacts>lambdaQuery().
                eq(BasicCustContacts::getContractNo, contractNo));
        return IResponse.success(basicCustContacts);
    }
}
